| Conditions | 8 |
| Paths | 8 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 14.0087 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | "use strict"; |
||
| 8 | 1 | const normalize = (meta = {}, level = 0) => { |
|
| 9 | if (level++ < 5) { |
||
| 10 | 187 | if (Array.isArray(meta)) { |
|
| 11 | return meta.map(metaData => normalize(metaData, level)); |
||
| 12 | 187 | } else if (meta instanceof Request) { |
|
| 13 | return transformers.request(meta); |
||
| 14 | 187 | } else if (meta instanceof Response) { |
|
| 15 | 7 | return transformers.response(meta); |
|
| 16 | 180 | } else if (meta instanceof Object) { |
|
| 17 | 66 | const newObject = {}; |
|
| 18 | 66 | for (let metaKey in meta) { |
|
| 19 | 171 | if (meta.hasOwnProperty(metaKey)) { |
|
| 20 | 171 | newObject[metaKey] = normalize(meta[metaKey], level); |
|
| 21 | } |
||
| 22 | } |
||
| 23 | |||
| 24 | 66 | return newObject; |
|
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | 114 | return meta; |
|
| 29 | }; |
||
| 30 | |||
| 64 |